var t = getApp();

Page({
    data: {
        year: "",
        month: "",
        m: "",
        w: "",
        show: !1,
        intrShow: !1,
        info: [],
        awardinfo: [],
        store_id: ""
    },
    onLoad: function(t) {
        t.id && this.setData({
            store_id: t.id
        }), wx.setNavigationBarTitle({
            title: "门店打卡"
        }), this.getDataNum(1), this.getData();
    },
    showClose: function() {
        this.setData({
            intrShow: !1,
            show: !1
        });
    },
    showTap: function() {
        this.setData({
            intrShow: !0
        });
    },
    goDetail: function() {
        wx.navigateTo({
            url: "/packageF/storeSign/storeSignDetail/storeSignDetail"
        });
    },
    getData: function() {
        var a = this, e = t.getNetAddresss("plugin.store-attendance.frontend.dashboard.index"), n = {
            year: this.data.year,
            month: this.data.month,
            store_id: this.data.store_id
        };
        t._getNetWork({
            url: e,
            data: n,
            success: function(t) {
                var e = t.data;
                1 == e.result ? a.setData({
                    info: e.data
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    attendance: function() {
        var a = this;
        if (this.data.info.attended) wx.showToast({
            title: "已打卡",
            icon: "none"
        }); else {
            var e = t.getNetAddresss("plugin.store-attendance.frontend.member.attendance");
            t._getNetWork({
                url: e,
                data: {
                    store_id: this.data.store_id
                },
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? (a.setData({
                        awardinfo: e.data.award,
                        show: !0
                    }), a.getData()) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    },
    getDataNum: function(t) {
        var a = new Date(), e = a.getFullYear();
        this.data.year = e;
        var n = a.getMonth() + t;
        this.data.month = n;
        var o = new Date(e, n, 0);
        this.data.m = o.getDate();
        var i = new Date(e, n - 1, 1).getDay();
        this.data.w = 14.27 * i, this.setData({
            w: this.data.w,
            m: this.data.m,
            month: this.data.month,
            year: this.data.year
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});